package areOccurrencesEqual;

public class SOlution {
    public boolean areOccurrencesEqual(String s) {
        //
        int[] cnt = new int[26];
        for (int i = 0; i < s.length(); i++) {
            cnt[s.charAt(i)-'a']++;
        }
        int t = -1;
        for (int i = 0; i < 26; i++) {
            if(t == -1) {
                if(cnt[i]!=0)t = cnt[i];
            } else {
                if(cnt[i]!=0) {
                    if(t!=cnt[i])return false;
                }
            }
        }
        return true;
    }
}